package com.tang.model.singleton;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/8/15 16:27
 * @Desc 单例模式之懒汉式
 * @Remarks
 */
public class SingletonB {
    private static volatile SingletonB instance;

    private SingletonB() {
    }

    /*
    DLC 双重检查
     */
    public static SingletonB getInstance() {
        if (null == instance) {
            synchronized (SingletonB.class) {
                if (null == instance) {
                    instance = new SingletonB();
                }
            }
        }
        return instance;
    }

}
